package com.gongren.project.job.pay;

import com.alibaba.dubbo.config.annotation.Reference;
import com.gongren.project.pay.rpc.api.taskRpc.ICpcnTaskRpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author houzhong
 * @Date 2017/9/1 13:09
 */
@Component("cpcnTask")
public class CpcnTask {

    private static Logger LOGGER = LoggerFactory.getLogger(CpcnTask.class);

    @Reference
    private ICpcnTaskRpcService cpcnTaskRpcService;

    /**
     * 每隔4小时执行一次
     */
    @Scheduled(cron = "0 0 */4 * * ?")
    public void cpcnFlowIng() {
        LOGGER.info("CpcnTask and cpcnFlowIng start");
        try {
            cpcnTaskRpcService.findAllCpcnFlowIng();

            LOGGER.info("CpcnTask and cpcnFlowIng end");
        }catch (Exception e) {
            LOGGER.error("CpcnTask and cpcnFlowIng：", e);
        }
    }

}
